package com.service.admin.base.controller;

import com.service.admin.base.service.MemberStarGradeConfigService;
import com.service.core.rest.BaseController;
import com.service.core.rest.response.BaseResponse;
import com.service.core.rest.response.MultiResponse;
import com.service.core.rest.response.OneResponse;
import com.service.core.rest.response.PageResponse;
import com.service.dao.model.MemberStarGradeConfig;
import com.service.dao.model.RecommendAwardConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;




/**
 * 会员星级等级配置
 *
 * @author xxxx
 * @email xxxx@qq.com
 * @date 2020-04-12 23:03:15
 */
@RestController
@RequestMapping("config/member-start-grade")
public class MemberStartGradeConfigController extends BaseController {
    @Autowired
    private MemberStarGradeConfigService memberStarGradeConfigService;

    /**
     * 会员星级等级配置
     * 列表
     * @author xxxx
     * @email xxxx@qq.com
     * @date 2020-04-12 23:03:15
     */
    @GetMapping("/list")
    public MultiResponse<MemberStarGradeConfig> listAll() {
        return successQueryMultiResponse(memberStarGradeConfigService.list());
    }

    /**
     * 会员星级等级配置
     * 信息
     * @author xxxx
     * @email xxxx@qq.com
     * @date 2020-04-12 23:03:15
     */
    @RequestMapping("/load/{id}")
    public OneResponse<MemberStarGradeConfig> load(@PathVariable("id") Integer id){
        return successQueryOneResponse( memberStarGradeConfigService.getById(id));
    }


    /**
     * 会员星级等级配置
     * 修改
     * @author xxxx
     * @email xxxx@qq.com
     * @date 2020-04-12 23:03:15
     */
    @RequestMapping("/modify")
    public BaseResponse modify(@RequestBody MemberStarGradeConfig memberStarGradeConfig){
            memberStarGradeConfigService.updateById(memberStarGradeConfig);
        return successBaseResponse();
    }

}
